package com.company;

import java.util.Arrays;

public class Yuekao7 {
    public static void main(String[] args) {
        int[] redball = new int[5];
        int blueball = 0;
        for (int i = 0; i < redball.length; i++) {
            redball[i] = (int) (Math.random() * 33 + 1);
            for (int j = 0; j < i; j++) {
                while (redball[i] == redball[j]) {
                    i--;
                }
            }
        }
        blueball = (int) (Math.random() * 16 + 1);
        System.out.println("红球随机数：" + Arrays.toString(redball));
        for (int i = 0; i < redball.length - 1; i++) {
            for (int j = 0; j < redball.length - 1 - i; j++) {
                if (redball[j] > redball[j + 1]) {
                    int temp = redball[j + 1];
                    redball[j + 1] = redball[j];
                    redball[j] = temp;
                }
            }
        }
        System.out.println("蓝球随机数："+blueball);
        System.out.println();
        System.out.print("本期产生的红色球是：");
        for (int i = 0; i < redball.length; i++) {
            if (redball[i] != blueball) {
                System.out.print(redball[i] + "\t");
            }
        }
        System.out.println();
        System.out.println("本期产生的蓝色球是：" + blueball);
    }
        //7、模拟双色球彩票开奖结果：随机生成一注双色球彩票，
        // 一注双色球彩票由6个不重复的红球（序号：1~33）和1个篮球（序号：1~16）构成。
    }

